#include<iostream>

struct Student
{
    char name[15];   
    unsigned short age;   
    char sex[10];        
};

union Ip4Address              // 公用一段内存，以最大的为准
{
    unsigned char c[4];
    unsigned int address;
};

enum color{
    RED,
    YELLOW,
    BLUE
};
int main(){
    using namespace std;
    cout<<sizeof(Student)<<endl;      //28，结构体存在内存对齐问题
    Student stu[2] = {
        {"zs",15,"man"},
        {"ls",16,"woman"}
    };

    cout<<sizeof(Ip4Address)<<endl;      // 4
    int ip4 = 0xF00A0B0C;
    Ip4Address ip;
    ip.address = ip4;
    cout<<int(ip.c[0])<<"."<<int(ip.c[1])<<"."<<int(ip.c[2])<<"."<<int(ip.c[3])<<endl;

    color co = RED;
    cout<<co<<endl;
    co = color(1);
    cout<<co<<endl;
    co = color::BLUE;
    cout<<co<<endl;

    return 0;
}